﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace pb_ws_client
{
    public partial class Post : Form
    {
        PostServiceReference.PostServiceSoapClient psr;

        public Post()
        {
            InitializeComponent();
            psr = new PostServiceReference.PostServiceSoapClient();
        }

        public void refreshData()
        {
            LogicLayer.dt_post = psr.GetUnexPostList(LogicLayer.SID);
            dgv_Post.DataSource = LogicLayer.dt_post;
        }

        private void Post_Load(object sender, EventArgs e)
        {
            refreshData();
        }

        private void dgv_Post_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow pr = dgv_Post.CurrentRow;
            string pid = pr.Cells[0].Value.ToString();
            PostExam pe = new PostExam(pid, psr, this);
            pe.Show();
        }

        private void btn_Detail_Click(object sender, EventArgs e)
        {
            DataGridViewRow pr = dgv_Post.SelectedRows[0];
            string pid = pr.Cells[0].Value.ToString();
            PostExam pe = new PostExam(pid, psr, this);
            pe.Show();
        }
    }
}
